package cn.fz.mpdemo.config;

import cn.fz.mpdemo.interceptor.LoginValidateInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginValidateInterceptor loginValidateInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginValidateInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login","/emp/*");
    }

    // @Override
    // public void addResourceHandlers(ResourceHandlerRegistry registry) {
    //     // WebMvcConfigurer.super.addResourceHandlers(registry);
    //     registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
    //     registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    // }
}
